package javaz.expression;

/**
 * @author natu
 * @date 2014-01-20
 */
public class SpecialReplace {
	
	public static void main(String[] args) {
		String str = "//Start of content// \"args\": \"The content\" //End of content//";
		System.out.println(str);
		str = str.replaceAll("\"args\": \"(:?.*)\"", "\"args\": [\"$1\"]");
		System.out.println(str);

		String marchStr = "5 * x^3 - 6 * x^1 + 1"; // => 5x<sup>3</sup> - 6x<sup>1</sup> + 1
		System.out.println(marchStr);
        String replaced = marchStr.replaceAll("(?m)(:?\\d+) \\* x\\^(:?\\d+)", "$1x<sup>$2</sup>");
        System.out.println(replaced);
	}

}
